﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Reflection;
using Microsoft.Practices.Prism.ViewModel;

namespace Payton.WP7.Common.Model
{
    public class SNSStatus : NotificationObject
    {
        SNSAccount account;

        public SNSAccount Account
        {
            get { return account; }
            set
            {
                account = value;
                RaisePropertyChanged(() => Account);
            }
        }

        private DateTime created_at;

        public DateTime CreatedTime
        {
            get
            {
                return created_at;
            }
            set
            {
                created_at = value;
                RaisePropertyChanged(() => CreatedTime);
            }
        }

        long timestamp;

        public long Timestamp
        {
            get
            {
                return timestamp;
            }
            set
            {
                timestamp = value;
                RaisePropertyChanged(() => Timestamp);
            }
        }


        private long id;

        public long Id
        {
            get
            {
                return id;
            }
            set
            {
                id = value;
                RaisePropertyChanged(() => Id);
            }
        }
        private string text;

        public string Text
        {
            get { return text; }
            set { text = value; RaisePropertyChanged(() => Text); }
        }
        private string source;

        public string Source
        {
            get
            {
                return source;
            }
            set
            {
                source = value;
                RaisePropertyChanged(() => Source);
            }
        }
        private bool favorited;

        public bool Favorited
        {
            get
            {
                return favorited;
            }
            set
            {
                favorited = value;
                RaisePropertyChanged(() => CreatedTime);
            }
        }
        private bool truncated;

        public bool Truncated
        {
            get
            {
                return truncated;
            }
            set
            {
                truncated = value;
                RaisePropertyChanged(() => Truncated);
            }
        }
        private string in_reply_to_status_id;

        public string ReplyToStatusId
        {
            get
            {
                return in_reply_to_status_id;
            }
            set
            {
                in_reply_to_status_id = value;
                RaisePropertyChanged(() => ReplyToStatusId);
            }
        }
        private string in_reply_to_user_id;

        public string ReplyToUserId
        {
            get
            {
                return in_reply_to_user_id;
            }
            set
            {
                in_reply_to_user_id = value;
                RaisePropertyChanged(() => ReplyToUserId);
            }
        }
        private string in_reply_to_screen_name;

        public string ReplyToScreenName
        {
            get
            {
                return in_reply_to_screen_name;
            }
            set
            {
                in_reply_to_screen_name = value;
                RaisePropertyChanged(() => ReplyToScreenName);
            }
        }
        private string thumbnail_pic;

        public string ThumbnailPic
        {
            get
            {
                return thumbnail_pic;

            }
            set { thumbnail_pic = value; RaisePropertyChanged(() => ThumbnailPic); }
        }
        private string bmiddle_pic;

        public string BmiddlePic
        {
            get
            {
                return bmiddle_pic;
            }
            set
            {
                bmiddle_pic = value;
                RaisePropertyChanged(() => BmiddlePic);
            }
        }
        private string original_pic;

        public string OriginalPic
        {
            get
            {
                return original_pic;
            }
            set
            {
                original_pic = value;
                RaisePropertyChanged(() => OriginalPic);
            }
        }
        private SNSUser user;

        public SNSUser User
        {
            get
            {
                return user;
            }
            set
            {
                user = value;
                RaisePropertyChanged(() => User);
            }
        }
        private SNSStatus retweeted_status;

        public SNSStatus RetweetedStatus
        {
            get
            {
                return retweeted_status;
            }

            set
            {
                retweeted_status = value;
                RaisePropertyChanged(() => RetweetedStatus);
            }
        }

        private GeoInfo geoInfo;

        public GeoInfo GeoInfo
        {
            get
            {
                return geoInfo;
            }
            set
            {
                geoInfo = value;
                RaisePropertyChanged(() => GeoInfo);
            }
        }

        private SNSProviderType provider;

        public SNSProviderType Provider
        {
            get
            {
                return provider;
            }
            set
            {
                provider = value;
                RaisePropertyChanged(() => Provider);
            }
        }

        private StatusType type;

        public StatusType Type
        {
            get
            {
                return type;
            }
            set
            {
                type = value;
                RaisePropertyChanged(() => Type);
            }
        }

        public override bool Equals(object obj)
        {
            var item = obj as SNSStatus;
            if (item == null)
                return false;
            else
            {
                return Id.Equals(item.Id);
            }
        }

        public override int GetHashCode()
        {
            return (Provider.ToString() + Id.ToString()).GetHashCode();
        }

        int repostCount = 0;

        public int RepostCount
        {
            get { return repostCount; }
            set
            {
                repostCount = value;
                RaisePropertyChanged(() => RepostCount);
            }
        }

        int commentCount = 0;

        public int CommentCount
        {
            get { return commentCount; }
            set
            {
                commentCount = value;
                RaisePropertyChanged(() => CommentCount);
            }
        }


        string prefix;

        public string Prefix
        {
            get { return prefix; }
            set
            {
                prefix = value;
                RaisePropertyChanged("Prefix");
            }
        }
    }

    public enum StatusType
    {
        Original, Repost, Reply, Comment, DirectMessage, Feed
    }
}
